package de.chessgame.network;

import io.netty.buffer.ByteBuf;
import cpw.mods.fml.common.network.simpleimpl.IMessage;

public class ChessMessage implements IMessage {
	
	public boolean buttonPressed;
	public int data;
	public int x;
	public int y;
	public int z;
	
	public ChessMessage() {}
	
	public ChessMessage(boolean buttonPressed, int data, int x, int y, int z) {
		this.buttonPressed = buttonPressed;
		this.data = data;
		this.x = x;
		this.y = y;
		this.z = z;
	}

	@Override
	public void fromBytes(ByteBuf buf) {
		buttonPressed = buf.readBoolean();
		data = buf.readInt();
		x = buf.readInt();
		y = buf.readInt();
		z = buf.readInt();
	}

	@Override
	public void toBytes(ByteBuf buf) {
		buf.writeBoolean(buttonPressed);
		buf.writeInt(data);
		buf.writeInt(x);
		buf.writeInt(y);
		buf.writeInt(z);

	}

}
